#pragma once

#include "stdio.h"
#include <list>

#include "Object.h"
#include "Rectangles.h"
#include "Circle.h"
#include "Plane.h"

#include "TouchDefine.h"
#include "CollisionManager.h"

using namespace std;

const static char* k_FILE_OBJECT = "SceneMng.txt";

#define FORM_OBJ_NUMBER		"#OBJECT_NUM %d\n"
#define FORM_OBJ_TYPE		"TYPE: %s\n"
#define FORM_POS_RECT		"POSITION: %f, %f, %d, %d\n"
#define FORM_POS_CIRCLE		"POSITION: %f, %f, %d\n"
#define FORM_OBJ_VELO		"VELOCITY: %d\n"

#define OBJ_TYPE_RECT		"RECT"
#define OBJ_TYPE_CIRCLE		"CIRCLE"
#define OBJ_TYPE_PLANE		"PLANE"

class SceneManager
{
public:
	SceneManager(void);
	~SceneManager(void);
	
	void Init(); // Load Objects from a text file
	void Update (float frameTime);
	void Render();
	void AddObject(Object *object);
	
	void TouchActionDown(ESContext *esContext, int x, int y);
	void TouchActionUp(ESContext *esContext, int x, int y);
	void TouchActionMove(ESContext *esContext, int x, int y);

	EObjectType GetTypeObject(char* type);

	static const int k_TYPE_MAX_LENG = 10;

private:
	list<Object*> m_ObjectList;
	Object* m_selectedObject;
	Touch *m_touch;
	CollisionManager* m_collidMgr;

	void SetTouchPosition(int x, int y);

};
